# -*- coding: utf-8 -*-
"""
date: Sat Dec 29 13:40:24 2018
python: Anaconda 3.6.5
author: kanade
email: kanade@blisst.cn
"""
import numpy as np


names = np.array(['zhangfei', 'zhaoyun', 'guanyu',
                  'huangzhong', 'machao'])
scores = np.array([90, 70, 60, 70, 90])
ages = np.array([50, 30, 20, 20, 40])
# 按照成績的升序打印姓名，成績相同的參考年齡的升序
print(names[np.lexsort((ages, scores))])
complexes = scores + ages * 1j
sorted_complexes = np.sort_complex(complexes)
print(complexes, sorted_complexes, sep='\n')
#             0  1 *2  3  4 *5  6
a = np.array([1, 2, 4, 5, 6, 8, 9])
print(a)
b = np.array([7, 3])
print(b)
c = np.searchsorted(a, b)
print(c)
# 将b数组中的元素按照c数组中的对应
# 位置插入a数组中，返回插入结果
d = np.insert(a, c, b)
print(d)
